package crudfx.navigation;
import javax.swing.*;
import java.awt.*;
import javax.swing.tree.*;
import crudfx.interop.*;
/**
 * @profile desktop
 * @author Sergey Surikov
 */
public class TreeControlLeaf extends TreeItem{
    override var tooltip="TreeControlLeaf";
    public var content:UIComponent;
    var renderer:DefaultTreeCellRenderer;
    init{
        renderer=new DefaultTreeCellRenderer();
        //isEditOnSelect=true;
        onSelect=function():Boolean{
            //action();
            return true;
            }
        }
    override public function add(tree:Tree,parent:DefaultMutableTreeNode):Void{
        tree.add(parent, this);
        }
    override public function getCellComponent(tree:JTree,value:Object
                                    ,selected:Boolean,expanded:Boolean
                                    ,leaf:Boolean,row:Integer
                                    ,hasFocus:Boolean):Component{
        var c:Component=content.getJComponent();
        c.setEnabled(true);
        return c;
        }
    }
